Template Tags

change_lang

Use this template tag to get the url of the given page in another language. The parameteres of this template tag are the language code and page object. Below is an example where we want to get the url of the current page in portuguese.

{% load wagtail_modeltranslation %}
{% change_lang 'pt' page %}

slugurl_trans

Use this template tag as a replacement for slugurl.

{% load wagtail_modeltranslation %}
{% slugurl_trans 'default_lang_slug' %}
{# or #}

get_available_languages_wmt

Use this template tag to get the current languages from MODELTRANSLATION_LANGUAGES (or LANGUAGES) from your setting file (or the default settings).

{% get_available_languages_wmt as languages %}
{% for language in languages %}
...
{% endfor %}
{% slugurl_trans 'pt_lang_slug' 'pt' %}